#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <string>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <climits>
#define int long long 
#define x first 
#define y second 
using namespace std ;
typedef pair<int,int> PII;
const int N = 1e5 + 10;
int n;
PII p[N];
int mimi[N];
vector<vector<int>> a(N,vector<int>()); 
void change(int i,int j,int x)
{
     a[i][j] = x;         
}
int query(int x)
{
    int s = 0;
    for(int i = 1; i <= x; i++)
    {
        s = min(s,mimi[i]);
    }
    return s;
}
void solve()
{
     
      cin >> n;
      for(int i = 1; i <= n; i++)
      {
          int m ;
          cin >> m;
          int mi = 0;
          for(int j = 1; j <= m; j++) 
          {
             cin >> a[i][j];
             mi = min(mi , a[i][j]);
          }
          mimi[i] = mi;
      }
      
      int q ;
      while( q -- )
      {
         int f;
         cin >> f;
         if(f == 2) 
         {
             int x;
             cin >> x;
             cout << query(x) << endl;
         }
         else if(f == 1)
         {
            int i,j,x;
            cin >> i >> j >> x;
            change(i,j,x); 
         }
      }
}
signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr),cout.tie(nullptr);
    int t  = 1 ;
   // cin >> t;
    while(t -- ) solve();
    return 0;
}